package demo1;

public class Test {
    public static void test1(Animal animal) {
        animal.eat();
    }

    public static void run(IRunable irunable) {
        irunable.running();
    }

    public static void fly(IFlyable iflyable) {
        iflyable.flying();
    }
    public static void swim(ISwimable iswimable) {
        iswimable.swimming();
    }
    public static void main(String[] args) {
        Dog dog = new Dog("旺财",6);
        Bird bird = new Bird("波波",2);
        Duck duck = new Duck("嘎嘎",8);
        test1(dog);
        test1(bird);
        test1(duck);
        run(dog);
        run(duck);
        fly(bird);
        fly(duck);
        swim(dog);
        swim(duck);
        Robot robot = new Robot();
        run(robot);
    }
}
